﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StyleMVVM.DependencyInjection;
using StyleMVVM.View;
using StyleMVVM.ViewModel;
using Windows.Foundation;
using Windows.UI.Xaml;

namespace ExampleApp.ViewModels
{
	public class PopupsViewModel : BaseViewModel
	{
		[Import]
		public IUIVisualizationService UIService { get; set; }

		[Import]
		public IMessageBoxService MessageBoxService { get; set; }

		public async void OpenPopupMenu(RoutedEventArgs eventArgs)
		{
			FrameworkElement element = eventArgs.OriginalSource as FrameworkElement;

			var selectedText = await UIService.PopupMenu(element, "Hello","GoodBye");

			if (!string.IsNullOrEmpty(selectedText))
			{
				MessageBoxService.Show("You Clicked: " + selectedText);
			}
			else
			{
				MessageBoxService.Show("You Clicked: Nothing");
			}
		}

		public void OpenPopupView(RoutedEventArgs eventArgs)
		{
			FrameworkElement element = eventArgs.OriginalSource as FrameworkElement;

			UIService.Popup(element,"PopupUserControlView", null, true, null,
				RelativePosition.Bottom | RelativePosition.Left, new Point(3,0));

		}

		[ActivationComplete]
		public void Activated()
		{
			
		}
	}
}
